# coding: utf-8
# @Author: 莫小鱼
from time import sleep

from selenium.webdriver.common.by import By

from AutoWebTest.page_object.login.login_scan_page import LoginScan
from AutoWebTest.utils.basepage import BasePage


class HomePage(BasePage):
    # URL
    url = "https://study.seewoedu.cn/"
    # 首页_登录
    home_login_ele = (By.XPATH, "/html/body/div/div/header/div/div[2]/div[3]/div/span[1]")
    # 首页_在线学习
    home_study_ele = (By.XPATH, "/html/body/div/div/header/div/div[1]/div/div/div/div[3]/div")
    # home_login断言
    assert_home_login = (By.XPATH,'//*[@id="normalLoginTab"]')
    assert_home_login_text = "扫码登录"


    def home_page(self):
        self.open_url(self.url)
        sleep(10)
        return self.current_url

    def home_login(self):
        # 进入首页
        self.open_url(self.url)
        # 点击 首页->登录
        self.click(self.home_login_ele)
        sleep(3)
        return LoginScan

    def home_study(self):
        # 进入首页
        self.open_url(self.url)
        # 点击 在线学习
        self.click(self.home_study_ele)
        sleep(3)
